/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.swe622.rmi.client;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.registry.Registry;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author jasbh292
 */
public class ClientImpl implements ClientInterface {

  //  public List<ServerInfo> QueryRegistry(String filename) {
public void QueryRegistry(String filename) {
        //Connect to the Registry Server

    List<ServerInfo> list = new ArrayList<ServerInfo>();
        // Assign security manager
    if (System.getSecurityManager() == null)
    {
        System.setSecurityManager   (new RMISecurityManager());
    }
        try {
           // Registry service = (Registry) Naming.lookup("rmi://" + args[0] + "/PowerService");
            Registry service = (Registry) Naming.lookup("rmi://" + list + "/PowerService");
            //Retrieve List of Servers
        } catch (NotBoundException ex) {
            Logger.getLogger(ClientImpl.class.getName()).log(Level.SEVERE, null, ex);
        } catch (MalformedURLException ex) {
            Logger.getLogger(ClientImpl.class.getName()).log(Level.SEVERE, null, ex);
        } catch (RemoteException ex) {
            Logger.getLogger(ClientImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
        

    }

//    public List<ServerInfo> QueryRegistry(String filename) {
//        throw new UnsupportedOperationException("Not supported yet.");
//    }
//
//    public List<ServerInfo> QueryRegistry(String filename) {
//        throw new UnsupportedOperationException("Not supported yet.");
//    }

}
